{* Smarty *}
{*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-06-22 16:54:54 +0200 (Sun, 22 Jun 2008) $
 * $Rev: 1204 $
 * $Author: styck $
 * $Id: ajax_showsetinfo.tpl 1204 2008-06-22 14:54:54Z styck $
 *}
{* Ajax page, doesn't need a head/foot tpl *}

<div class="closequickwindow">
<img src="{$IMGDIR}/closebutton.png" class="buttonlike" onclick="javascript:CloseQuickDisplay();" alt="X"/>
</div>
{* We need some space otherwise the close bar will overlap *}
<br/><br/>
{if $srctype == 'edit'}
<div>
	<input type="hidden" id="extsetinfodisplay:{$setID}" value="edit"/>
	<form id="ext_setinfo_{$setID}" method="post" action="">
	<div><input type="hidden" name="values[binarytype]" value="{$binarytype}"/></div>
	<table class="quickdisplay">
		<tr><td colspan="2"><b>{$setname}</b></td></tr>
		<tr><td colspan="2"><br/><td></tr>
		<tr><td class="extsetnamewidth right">
		{$LN_showsetinfo_typeofbinary}:
		</td><td class="extsetinput">
			<select onchange="SaveExtSetBinaryType('{$setID}',this,'save', {$type});" name="binarytype">
			{foreach key=binid item=bintype from=$binarytypes}
				<option value="{$binid}" {if $binid == $binarytype}selected="selected"{/if} >{$bintype}</option>
			{/foreach}
			</select><br/>
		</td></tr>
	{foreach item=vals from=$display}
		<tr><td class="extsetnamewidth right">{$vals.name|capitalize}:</td>
		<td class="extsetinput">
			{if $vals.edit == 'longtext'}<input size="80" type="text" name="values[{$vals.field|escape}]" value="{$vals.value|escape}"/>{/if}
			{if $vals.edit == 'text'}<input type="text" name="values[{$vals.field|escape}]" value="{$vals.value|escape}"/>{/if}
			{if $vals.edit == 'checkbox'}
				{* Checkboxes only return a value if they're checked, so let's have a default 0 value: *}
				<input type="hidden" name="values[{$vals.field|escape}]" value=""/>
				<input type="checkbox" name="values[{$vals.field|escape}]" {if $vals.value == 1}checked="checked"{/if} value="1"/>{
			/if}
			{if $vals.edit == 'select'}
			<select name="values[{$vals.field|escape}]">
				{foreach item=opt from=$vals.editvalues}
				<option value="{$opt}" {if $opt == $vals.value} selected="selected"{/if}>{$opt|capitalize}</option>
				{/foreach}
			</select>
			{/if}
		</td></tr>
	{/foreach}
	<tr><td></td><td>
	<input type="submit" value="{$LN_apply}" class="submit" alt="{$LN_apply}" name="submit_button" onclick="javascript:SaveExtSetInfo('{$setID}', {$type}); return false;"/>
	</td></tr>
	</table>
	</form>
</div>	
{else}
{* Display: *}
<div>
	<input type="hidden" id="extsetinfodisplay:{$setID}" value="display"/>

{capture assign=fileoverview}
{section name=x loop=$files}
<tr class="small vbot even">
        <td class="preview">
        <a onclick="select_preview('{$files[x].binaryID}','{$groupID}')" class="buttonlike" {popup text="Preview"}>
        <img src="{$IMGDIR}/icon_preview.png" alt="preview"/></a> 
        </td>

	<td class="preview">
	{$files[x].cleanfilename|escape}
	</td>

        <td class="preview right nowrap">{$files[x].size}</td>
</tr>
{/section}
{/capture}

<table class="quickdisplay">
<tr class="vtop small left"><td class="bold nowrap extsetnamewidth">{$LN_showsetinfo_postedin}</td>
	<td>{$groupname|escape:html}</td></tr>
{if $fromnames neq ''}
<tr class="vtop small left"><td class="bold nowrap">{$LN_showsetinfo_postedby}</td>
	<td>{$fromnames|escape:html}</td></tr> 
{/if}
<tr class="vtop small left"><td class="bold nowrap">{$LN_showsetinfo_size}</td>
	<td>{if $binaries gt 0}{$binaries} {$LN_showsetinfo_files}{if $articlesmax > 0} ({$LN_showsetinfo_shouldbe} {$articlesmax}){/if} - {/if}{if $totalsize gt 0 }{$totalsize}{else}?{/if}</td></tr>
{if $par2s neq ''}
	<tr class="vtop small left"><td class="bold nowrap">{$LN_showsetinfo_par2}</td>
	<td>{$par2s}</td></tr>
{/if}
</table>

{capture assign=extsetoverview}
	<table class="extsetinfo">
	{assign var=looped value=0}
	{foreach item=vals from=$display name=loopio}
	{if $vals.value != "0" && $vals.value != "" && $vals.value != "name"}
		{assign var=looped value=`$looped+1`}
		<tr class="vtop small left"><td class="bold nowrap extsetnamewidth">{$vals.name|escape}:</td><td>
		{if $vals.display == 'text'}{$vals.value|escape}{/if}
		{if $vals.display == 'url'}<a href="{$vals.value|escape}" target="_blank">{$vals.value|escape}</a>{/if}
		{if $vals.display == 'number'}<b>{$vals.value|escape}</b>{/if}
		{if $vals.display == 'checkbox'}{if $vals.value == 1}Yes{else}No{/if}{/if}
		</td></tr>
	{/if}
	{/foreach}
	</table>
{/capture}

{if $looped > 0}
{$extsetoverview}
{/if}

<table class="quickdisplay">
{$fileoverview}
</table>
</div>

{/if}
